<div
  #textarea
  class="x-textarea"
  [class.x-flex]="justify || align || direction"
  [class.x-disabled]="disabled"
  [class.x-required]="requiredIsEmpty"
  [class.x-invalid]="invalid"
  [class.x-clearable]="clearable"
  [class.x-clear-show]="clearShow"
  [class.x-textarea-icon]="getIcon"
  [class.x-textarea-icon-left]="getIconLayoutLeft"
  [class.x-textarea-icon-right]="getIconLayoutRight"
  [ngClass]="classMap"
>
  <label *ngIf="label" [style.width]="labelWidth" [ngClass]="labelMap">{{ label }}</label>
  <div class="x-textarea-row">
    <textarea
      #textareaRef
      [placeholder]="placeholder"
      [required]="required"
      [disabled]="disabled"
      [readonly]="readonly"
      [maxlength]="maxlength"
      [(ngModel)]="value"
      (ngModelChange)="change($event)"
      [style.height]="height"
      [style.padding-left.rem]="paddingLeft"
      [style.padding-right.rem]="paddingRight"
    ></textarea>
    <x-icon *ngIf="clearShow" class="x-textarea-clear" type="fto-x" (click)="onClear()"></x-icon>
    <x-icon *ngIf="icon && ((!clearShow && getIconLayoutRight) || getIconLayoutLeft)" [type]="icon" [spin]="iconSpin"></x-icon>
    <span class="x-textarea-max-length" *ngIf="maxlength">{{ lengthTotal }}</span>
    <span class="x-textarea-error-message" *ngIf="invalid">{{ invalidMessage }}</span>
    <ng-container *ngIf="requiredIsEmpty || invalid">
      <div class="x-border-error x-top-left"></div>
      <div class="x-border-error x-top-right"></div>
      <div class="x-border-error x-bottom-left"></div>
      <div class="x-border-error x-bottom-right"></div>
    </ng-container>
  </div>
</div>
